home *** CD-ROM | disk | FTP | other *** search
/ Champak 122 / Vol 122.iso / games / super_cr.swf / scripts / DefineSprite_380 / frame_72 / DoAction.as
Encoding:
Text File  |  2011-01-06  |  1.2 KB  |  55 lines

  1. var immobile = true;
  2. var pitchSpeed = 200 - psy;
  3. var pitchDistance = 0;
  4. var playerSpeed = 0;
  5. var playerDistance = 0;
  6. var runStage = 0;
  7. onEnterFrame = function()
  8. {
  9.    pitchDistance += pitchSpeed / 144;
  10.    playerDistance += playerSpeed / 144;
  11.    pitchSpeed *= 0.9999;
  12.    pitchDistanceRnd = Math.round(pitchDistance) - Math.round(playerDistance);
  13.    pitchSpeedRnd = Math.round(pitchSpeed);
  14.    playerSpeedRnd = Math.round(playerSpeed);
  15.    if(!immobile)
  16.    {
  17.       switch(runStage)
  18.       {
  19.          case 0:
  20.             if(Key.isDown(39))
  21.             {
  22.                playerSpeed++;
  23.                runStage = 1;
  24.             }
  25.             else if(Key.isDown(37))
  26.             {
  27.                playerSpeed++;
  28.                runStage = 2;
  29.             }
  30.             break;
  31.          case 1:
  32.             if(Key.isDown(37))
  33.             {
  34.                playerSpeed++;
  35.                runStage = 2;
  36.             }
  37.             break;
  38.          case 2:
  39.             if(Key.isDown(39))
  40.             {
  41.                playerSpeed++;
  42.                runStage = 1;
  43.             }
  44.       }
  45.    }
  46. };
  47. ball.onEnterFrame = function()
  48. {
  49.    this._x += 100;
  50.    if(this._x > Stage.width + 20)
  51.    {
  52.       delete this.onEnterFrame;
  53.    }
  54. };
  55.